<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/2/19 0019
 * Time: 17:28
 */

namespace factory;

//简单工厂
class SampleFactory
{
    //生产方法
    public static function produce($type = "")
    {
        switch ($type) {
            case "apple":
                return new Apple();
                break;
            case "banana":
                return new Banana();
                break;
            default:
                echo "不支持生产的水果！\n";
                break;
        }
    }
}